<template>
  <div class="login">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="账号">
        <el-input v-model="form.username"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="form.password"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submit">登陆</el-button>
        <el-button @click="test">测试token</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { login, getuser } from "@/api/login.js";
export default {
  data() {
    return {
      form: {
        username: "",
        password: ""
      }
    };
  },
  methods: {
    submit() {
      login("/system/login", this.form).then((res) => {
        console.log(res);
      });
    },
    test() {
      getuser("/system/list").then((res) => {
        console.log(res);
      });
    }
  }
};
</script>
